package com.terren.spider.core.html.scheme.impl;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.terren.spider.core.html.configuration.Configuration;
import com.terren.spider.db.dbsource.DBSourceManager;
import com.terren.spider.db.service.CommentsService;
import com.terren.spider.entity.biz.UnionComments;
import com.terren.spider.util.common.CommonUtil;
/**
 * 澎湃新闻网
 * @author Terren
 *
 */
public class ThePaperScheme extends BasicCustomScheme{

	private CommentsService commentsService;

	@Override
	public Set<String> findTargetUrl(Configuration configuration) {
		commentsService = CommonUtil.getBean(CommentsService.class);
		Set<String> idSet=new HashSet<>();
		try {
			UnionComments unionComments=new UnionComments();
			// 更换数据源
			unionComments.setDbType(DBSourceManager.otherDBSource);
			List<String> idList=commentsService.getThePaperIDList(unionComments);
			for (int i = 0; i < idList.size(); i++) {
				idSet.add("https://app.thepaper.cn/clt/jsp/v3/content.jsp?c="+idList.get(i)+"&WD-UA=Dalvik/1.6.0%20(Linux;%20U;%20Android%204.4.2;%20PE-TL20%20Build/HuaweiPE-TL20)%20%E6%BE%8E%E6%B9%83%E6%96%B0%E9%97%BB/5.4.4&WD-RESOLUTION=1080*1776&WD-VERSION=5.4.4&WD-CHANNEL=huawsc&PAPER-CLIENT-TYPE=04&WD-CLIENT-TYPE=04&WD-UUID=865586021805595&WD-SYSTEM=4.4.2");
			}
				
		} catch (Exception e) {
			e.printStackTrace();
			log.error("ThePaperScheme findTargetUrl error",e);
		} 
		return idSet;
	}
	

}
